package com.ggkt.common.utils;

import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author ggkt
 * @Description
 */
public class ExportExcelForJxlUtil {
    // date转到时间stirng
    public static String getNowDateString(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        String sNowTime = sdf.format(date);
        return sNowTime;

    }
    public static void putRows(WritableSheet wsdWords, int rowNum,
                                List<String> cells, WritableCellFormat wcfF) throws RowsExceededException, WriteException {
        for (int j = 0; j < cells.size(); j++) {
            Label cell = new Label(j, rowNum, cells.get(j)==null?"":""+cells.get(j),wcfF);
            wsdWords.addCell(cell);
        }
    }
}
